package org.budo.graph.service.util;

import java.sql.Connection;
import java.util.Map;

import org.budo.graph.druid.filter.connection.ActiveConnectionFilter;
import org.budo.graph.druid.filter.connection.ActiveConnectionFilterUtil;
import org.springframework.context.ApplicationContext;

/**
 * @author lmw
 */
public class ActiveConnectionsUtil {
    public static String writeActiveConnectionsResponse(ApplicationContext applicationContext, String url) {
        ActiveConnectionFilter instance = ActiveConnectionFilter.getInstance();
        if (null == instance) {
            return "ActiveConnectionFilter.instance is null";
        }

        Map<Connection, Object> activeConnections = instance.getActiveConnectionsCopy();
        return ActiveConnectionFilterUtil.activeConnectionsToHtml(activeConnections);
    }
}